class Solution {
public:
    std::string convertToTitle(int n)
    {
        std::string r = "";
        while(n) {
            r = (char) ((n - 1) % 26 + 'A') + r;
            n = (n - 1) / 26;
        }
        return r;
    }
};